package Java.BlackHorse.InetAddr;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddrDemo1 {
    /*
    * static InetAddress getByName(String host) 确定主机的ip地址，参数可以是ip地址也只有是主机名称
    * String getHostName() 获得此ip的主机名
    * String getHostAddress() 返回文本显示中的ip地址
    * */
    public static void main(String[] args) throws UnknownHostException {
//        InetAddress addr = InetAddress.getByName("192.168.67.103");
        InetAddress addr = InetAddress.getByName("LAPTOP-7CHC2O7Q");
        System.out.println(addr);

        String name = addr.getHostName();
        System.out.println(name);

        String address = addr.getHostAddress();
        System.out.println(address);

    }
}